package PTA.ch05;
import java.util.Scanner;
public class ex01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int []arr=new int[5];
        while(true){
            String str=sc.next();
            if(str.equals("arr")){
                int n=sc.nextInt();
                if(n>1||n<0){
                    System.out.println("java.lang.ArrayIndexOutOfBoundsException: "+n);

                }
            }else if (str.equals("num")){
                String num=sc.next();
                char p=num.charAt(0);
                if (p>5||p<4){
                    //输出String类型时，可能带有引号
                    System.out.println("java.lang.NumberFormatException: For input string: \""+p+"\"");
                }
            }
            if (str.equals("null")){
                System.out.println("java.lang.NullPointerException");
            }else if (str.equals("cast")){
                System.out.println("java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer");
            }else if (str.equals("other")){
                return;
            }
        }
    }}
